public class LazySingleton {
    private static LazySingleton instance;

    private LazySingleton() {

    }

    // synchronized保证线程安全
    public static synchronized LazySingleton getInstance() {
        if (instance == null) {
            instance = new LazySingleton();
        }
        return instance;
    }
}
